import { exportClearingRecordUrl , getYesOrNot} from "@/api/print/mesProdBarcodePrint"
import { exportExcel } from "@/utils/judge"

// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportClearingRecordUrl
    //auth: "auth:operlog:export", //权限字段
  }
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.details"),
    type: "info",
    class: "row-btn-info",
    handleName: "detail" //点击时返回的标识
  }
]
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    planCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.planCode")
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodWorkOrderCode")
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodCode")
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodName")
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.uniqueCode")
    },
    clearByName: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.clearByName")
    },
    clearTime: {
      type: "datetimerange",

      label: $i18n.t("mesUniqueCodeClearingRecord.clearTime"),
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss",
        searchArrKey: ["clearTimeMin", "clearTimeMax"]
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    planCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.planCode"),
      layout: 12,
      required: false
    },
    orderCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodWorkOrderCode"),
      layout: 12,
      required: false
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodCode"),
      layout: 12,
      required: false
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.prodName"),
      layout: 12,
      required: false
    },
    clearByName: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.clearByName"),
      layout: 12,
      required: false
    },
    clearTime: {
      type: "datetime",
      label: $i18n.t("mesUniqueCodeClearingRecord.clearTime"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd HH:mm:ss"
      }
    },
    clearReason: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.clearReason"),
      layout: 12,
      required: false
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.seriesCode"),
      layout: 12,
      required: false
    },
    seriesName: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.seriesName"),
      layout: 12,
      required: false
    },
    planBeginDate: {
      type: "date",
      label: $i18n.t("mesUniqueCodeClearingRecord.planBeginDate"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd"
      }
    },
    planEndDate: {
      type: "date",
      label: $i18n.t("mesUniqueCodeClearingRecord.planEndDate"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd"
      }
    },
    barcodePrintTemp: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.barcodePrintTemp"),
      layout: 12,
      required: false
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.uniqueCode"),
      layout: 12,
      required: false
    },
    // boxcodeFront: {
    //   type: "input",
    //   label: $i18n.t("mesUniqueCodeClearingRecord.boxCodeFront"),
    //   layout: 12,
    //   required: false
    // },
    // boxcodeBack: {
    //   type: "input",
    //   label: $i18n.t("mesUniqueCodeClearingRecord.boxCodeBack"),
    //   layout: 12,
    //   required: false
    // },
    // serialNumber: {
    //   type: "number",
    //   label: $i18n.t("mesUniqueCodeClearingRecord.serialNumber"),
    //   layout: 12,
    //   required: false
    // },
    lineName: {
      type: "input",
      label: $i18n.t("common.lineName"),
      layout: 12,
      required: false
    },
    lineCode: {
      type: "input",
      label: $i18n.t("common.lineCode"),
      layout: 12,
      required: false
    },
    isPrint: {
      type: "select",
      label: $i18n.t("mesUniqueCodeClearingRecord.isPrint"),
      layout: 12,
      required: false,
      prop: {
        value: "value",
        text: "description"
      },
      options: async (data) => {
        const list = await getYesOrNot()
        return list.data.result
      }
    },
    remark: {
      type: "textarea",
      label: $i18n.t("common.remark"),
      layout: 12,
      required: false
    }
  }
}
//导入数据
export const importFormDescDialog = {
  span: 24,
  disabled: false,
  isShowSubmitBtn: true,
  formDesc: {
    model: {
      type: "button",
      label: "",//$i18n.t("mesUniqueCodeClearingRecord.model"),
      layout: 24,
      required: false,
      title: $i18n.t('common.downloadTemplate'),
      style: {
        color: "#1867c0",
        fontSize: "14px"
      },
      on: {
        click: () => {
          exportExcel(downloadTemplateUrl)
        }
      }
    },
    file: {
      type: "input",
      label: $i18n.t("mesUniqueCodeClearingRecord.file"),
      layout: 24
      // required: true,
    }
  }
}
